home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
pascal
/
parstp25.zip
/
CALCCW.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1994-02-14
|
601b
|
33 lines
// callcw.c - An example of a C program that uses the parser
#include <string.h>
#include "parslib.h"
#include <stdio.h>
#include <math.h>
char s[100] = "";
double result;
short valid;
int main()
{
printf("CALC CW - HyperAct Inc.\n");
// printf("%ld, %ld", &s, &valid);
while (strcmp(s, "EXIT") != 0) {
printf("CALC> ");
gets(s);
strupr(s);
if (strcmp(s, "EXIT") != 0) {
result = GETEXPR(s, valid);
if (valid)
printf("\n = %E\n", result);
else
printf("\n error at position %d\n", floor(result));
} // if ..
} // while ..
return 0;
}